package com.dragee.controller;

import com.dragee.util.HttpTokenUtil;
import com.dragee.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tys on 9/18/20
 */
@RestController
public class TestController {
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private HttpTokenUtil httpTokenUtil;

    @RequestMapping("set/{key}/{value}")
    public String redisSet (@PathVariable("key") String key, @PathVariable("value") String value) {
        redisUtil.set(key, value, 20);
        return "success";
    }
    @RequestMapping("get/{key}")
    public String redisGet (@PathVariable("key") String key) {
        return redisUtil.get(key);
    }
    @RequestMapping("getAuthToken")
    public String getAuthToken () {
        return httpTokenUtil.getAuthToken();
    }

}
